|
|
Joined: Feb 2002
Posts: 2,286
Veteran
|
|
Veteran
Joined: Feb 2002
Posts: 2,286 |
Hi,
I am trying to find a way to eliminate the ?Cat=1,2,3 from URL's in the category view.
It is not that I think that people will chop off the end, but rather if I add any new categories, and then sort then into alphabetical order, the URL's will no longer point to the correct sections.
Ideally it would be nice if Threads had a separate sorting of categories from their actual numbers - but until this happens I need to find a way to perhaps display ubbthreads.php?Cat=1,2,3 as say section1.php - or even as an index.php in a sub-folder. I would like to avoid a 100% frame, or a simple URL re-direction, as people might bookmark the version with the Cat=1,2,3, and then visit a week later to find different forums (not good!).
Any suggestions will be VERY gratefully received.
Thanks,
Ian
Fans Focus - Focusing on Fans of Sport (Okay - mainly football (the British variety at the moment - but expanding all the time....)
|
|
|
|
|
Joined: Jun 2001
Posts: 3,273
That 70's Guy
|
|
That 70's Guy
Joined: Jun 2001
Posts: 3,273 |
I have an idea that may work. Not sure though and would require some editing. I would set up some variables in the config.inc.php file as follows: $mycategory[0] = "1,2,3"; $mycategory[1] = "4,5"; $mycategory[2] = "6"; Then in every file that uses this: code:
// ----------------------------------------------------------------- // If we have a Cat variable then we need to set it up for the query if ($Cat) { $pattern = ","; $replace = " OR Cat_Number = "; $catonly = ereg_replace($pattern,$replace,$Cat); $catonly = "WHERE Cat_Number = " . $catonly; }
change it to this: code:
// ----------------------------------------------------------------- // If we have a Cat variable then we need to set it up for the query if ($Cat) { $MyCatArray = split(",",$Cat); $CatNumber = $MyCatArray[0]; $RealCat = $mycategory[$CatNumber]; $pattern = ","; $replace = " OR Cat_Number = "; $catonly = ereg_replace($pattern,$replace,$RealCat); $catonly = "WHERE Cat_Number = " . $catonly; }
Now only the first number of the Cat variable is used to signify all of the categories. I think this will work. 
|
|
|
|
|
Joined: Nov 2001
Posts: 10,369
I type Like navaho
|
|
I type Like navaho
Joined: Nov 2001
Posts: 10,369 |
Wow that's a good idea Dave. I might just need to roll up my sleeves and try that.
I have buttons at the top of each screen for specific categories.... but I have to go back and change all the links when we reorganize categories. It would be cool to just make a slight change once in the config file.
|
|
|
|
|
Joined: Jun 2001
Posts: 3,273
That 70's Guy
|
|
That 70's Guy
Joined: Jun 2001
Posts: 3,273 |
Thanks.  After I posted it I really started to like it myself... LoL It could be handy in various situations. 
|
|
|
|
|
Joined: Feb 2002
Posts: 2,286
Veteran
|
|
Veteran
Joined: Feb 2002
Posts: 2,286 |
Looks a good idea. Could just work. Do I assume that many of the pages have this code? Ian.
Fans Focus - Focusing on Fans of Sport (Okay - mainly football (the British variety at the moment - but expanding all the time....)
|
|
|
|
|
Joined: Jun 2001
Posts: 3,273
That 70's Guy
|
|
That 70's Guy
Joined: Jun 2001
Posts: 3,273 |
I would think that any page that needs to load information dealing with posts would have this code in them.
|
|
|
|
|
Joined: Feb 2002
Posts: 2,286
Veteran
|
|
Veteran
Joined: Feb 2002
Posts: 2,286 |
Question - is there any php software around (that you know of) that would do a global search of all .php pages in a particular folder. For that matter, what is a decent php editing package (apart from wordpad  ) I think I will try and see if this works! Ian.
Fans Focus - Focusing on Fans of Sport (Okay - mainly football (the British variety at the moment - but expanding all the time....)
|
|
|
|
|
Joined: May 1999
Posts: 3,039
Guru
|
|
Guru
Joined: May 1999
Posts: 3,039 |
I just download the trialware of Zend Studio. I've always done my php coding in vi directly on the server but have been looking at something for my laptop. Zend Studio looks powerful, but it might be a bit much for what I need.
UBB.threads Developer
|
|
|
|
|
Joined: Mar 2000
Posts: 21,080 Likes: 3
I type like Navaho
|
|
I type like Navaho
Joined: Mar 2000
Posts: 21,080 Likes: 3 |
ultra edit will do a search of any type/ all types of files for any string. You can display the list to a results window, and/or search/replace for that string. You can specify a particular folder and include all subfolders as well if you choose http://www.ultraedit.com
|
|
|
|
|
Joined: May 1999
Posts: 241
Coder
|
|
Coder
Joined: May 1999
Posts: 241 |
PHPEdit is supposed to be really nice as well... it has a built in debugger, class documenter, and a ton of other nice features. Still in beta, but worth the danger, according to a good friend of mine. 
|
|
|
|
|
Joined: Feb 2002
Posts: 2,286
Veteran
|
|
Veteran
Joined: Feb 2002
Posts: 2,286 |
Hi Dave, Getting there.... The code that you mentioned only appears in categories.php & ubbthreads.php So also altered... in search.php replace code: // ----------------------------------------------- // If we have a Cat variable we only search those if ($Cat) { $pattern = ","; $replace = " OR Bo_Cat = "; $thiscat = ereg_replace($pattern,$replace,$Cat); $catonly = "AND (Bo_Cat = $thiscat )"; }
with code: // ----------------------------------------------------------------- // If we have a Cat variable then we need to set it up for the query if ($Cat) { $MyCatArray = split(",",$Cat); $CatNumber = $MyCatArray[0]; $RealCat = $mycategory[$CatNumber]; $pattern = ","; $replace = " OR Bo_Cat = "; $thiscat = ereg_replace($pattern,$replace,$RealCat); $catonly = "AND (Bo_Cat = $thiscat )"; } and in dosearch.php replace code: if ($Cat) { $pattern = ","; $replace = " OR Bo_Cat = "; $thiscat = ereg_replace($pattern,$replace,$RealCat); $catonly = "AND (Bo_Cat = $thiscat )"; } with code: if ($Cat) { $MyCatArray = split(",",$Cat); $CatNumber = $MyCatArray[0]; $RealCat = $mycategory[$CatNumber]; $pattern = ","; $replace = " OR Bo_Cat = "; $thiscat = ereg_replace($pattern,$replace,$RealCat); $catonly = "AND (Bo_Cat = $thiscat )"; }
however we now have the following situation... ... displays fine in forums, and the search forums pull down list is correct under the search page, and indeed the search appears to work as well. However when we display the threads from the last 24/48/7 we have the same 'bug' that was in the early beta versions - i.e. several of the threads are displayed in the border colour of the cell rather than the cell colour. See this link as an example. We also need to alter editemail.php, which I assume controls the subscriptions... from code: // ------------------------------------------------------------------ // if we are allowing subscribes then we need to put that on the page if ($config['subscriptions']) { if ($Cat) { $Catchooser = "AND Bo_Cat in ($Cat)"; } to code: // ------------------------------------------------------------------ // if we are allowing subscribes then we need to put that on the page if ($config['subscriptions']) { if ($Cat) { $MyCatArray = split(",",$Cat); $CatNumber = $MyCatArray[0]; $RealCat = $mycategory[$CatNumber]; $Catchooser = "AND Bo_Cat in ($RealCat)"; } (but this appears not to work, as the additional forums are not showing up in the CP subscriptions bit). I also tried altering config.inc.php to // ----------------- // Category Variables $mycategory[1] = "1,2,9,17"; $mycategory[canvey] = "1,2,9,17"; $mycategory[3] = "10,11,12,13,14,15,16"; to see if a word work as well, which it does - the weird bit, is in the last 24/48/7 all the cells are dark, but with the number 1 as the category one of the cells is the correct colour Any thoughts Dave? Regards, Ian
Fans Focus - Focusing on Fans of Sport (Okay - mainly football (the British variety at the moment - but expanding all the time....)
|
|
|
|
|
Joined: Feb 2002
Posts: 2,286
Veteran
|
|
Veteran
Joined: Feb 2002
Posts: 2,286 |
jumper.php is also wrong - but that one has got me stumped! Tried various combinations without joy.
Ian.
Fans Focus - Focusing on Fans of Sport (Okay - mainly football (the British variety at the moment - but expanding all the time....)
|
|
|
|
|
Joined: Jun 2001
Posts: 3,273
That 70's Guy
|
|
That 70's Guy
Joined: Jun 2001
Posts: 3,273 |
Hi Ian, The search layout may be at fault, not sure. The display shouldn't be affected by the data returned (or not returned).  Yes you could place words into this: $mycategory[canvey] = "1,2,9,17"; but threads uses numbers to address the categories so you will (or should never)  see an url with Cat=canvey,2,4,7 in it. The other thing is that if you had an url with a Cat variable set to a word some scripts may see this as the value zero but I'm not 100% sure. (0 = all cats) I'm still loading software and setting things up here. Once I have everything set up I'll look over the search script to see what is going wrong. 
|
|
|
|
|
Joined: Feb 2002
Posts: 2,286
Veteran
|
|
Veteran
Joined: Feb 2002
Posts: 2,286 |
Okidoki. BTW - the word option does not work in every case, so forget that (at the moment  ) Thanks in advance for having a look. Ian
Fans Focus - Focusing on Fans of Sport (Okay - mainly football (the British variety at the moment - but expanding all the time....)
|
|
|
|
|
Joined: Feb 2002
Posts: 2,286
Veteran
|
|
Veteran
Joined: Feb 2002
Posts: 2,286 |
I have battled with this additional hack to eliminate the categories, but I think it has beaten me  If anyone has any ideas as to how I can get round them, I would be eternally grateful - with at least 100 categories, and potentially 10 times that, I need to find a different method Ian
Fans Focus - Focusing on Fans of Sport (Okay - mainly football (the British variety at the moment - but expanding all the time....)
|
|
|
Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.
Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
|
|
badfrog
somewhere on the coast of Maine
Posts: 94
Joined: March 2007
|
|
|
Forums63
Topics37,583
Posts293,955
Members13,824
| |
Most Online151,614 Nov 14th, 2025
|
|
Currently Online 536
Topics Created 0
Posts Made 0
Users Online 0
Birthdays 23
|
|
|
|